{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Titanic - Exploration \n",
    "In this notebook, we will see the basic data exploration of the Titanic dataset "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# importing the necessary packages #\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from sklearn import linear_model as lm\n",
    "from sklearn.cross_validation import train_test_split\n",
    "from matplotlib import pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# reading the train file and saving it as a pandas data frame #\n",
    "train_df = pd.read_csv('../Data/train.csv')\n",
    "test_df = pd.read_csv('../Data/test.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train dataframe shape is :  (891, 12)\n",
      "Test dataframe shape is :  (418, 11)\n"
     ]
    }
   ],
   "source": [
    "# dimensions of the input data (number of rows and columns) #\n",
    "print \"Train dataframe shape is : \", train_df.shape\n",
    "print \"Test dataframe shape is : \", test_df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index([u'PassengerId', u'Survived', u'Pclass', u'Name', u'Sex', u'Age',\n",
       "       u'SibSp', u'Parch', u'Ticket', u'Fare', u'Cabin', u'Embarked'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# name of the columns #\n",
    "train_df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index([u'PassengerId', u'Pclass', u'Name', u'Sex', u'Age', u'SibSp', u'Parch',\n",
       "       u'Ticket', u'Fare', u'Cabin', u'Embarked'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C85</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>C123</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Moran, Mr. James</td>\n",
       "      <td>male</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>330877</td>\n",
       "      <td>8.4583</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>McCarthy, Mr. Timothy J</td>\n",
       "      <td>male</td>\n",
       "      <td>54</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>17463</td>\n",
       "      <td>51.8625</td>\n",
       "      <td>E46</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Palsson, Master. Gosta Leonard</td>\n",
       "      <td>male</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>349909</td>\n",
       "      <td>21.0750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)</td>\n",
       "      <td>female</td>\n",
       "      <td>27</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>347742</td>\n",
       "      <td>11.1333</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Nasser, Mrs. Nicholas (Adele Achem)</td>\n",
       "      <td>female</td>\n",
       "      <td>14</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>237736</td>\n",
       "      <td>30.0708</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   PassengerId  Survived  Pclass  \\\n",
       "0            1         0       3   \n",
       "1            2         1       1   \n",
       "2            3         1       3   \n",
       "3            4         1       1   \n",
       "4            5         0       3   \n",
       "5            6         0       3   \n",
       "6            7         0       1   \n",
       "7            8         0       3   \n",
       "8            9         1       3   \n",
       "9           10         1       2   \n",
       "\n",
       "                                                Name     Sex  Age  SibSp  \\\n",
       "0                            Braund, Mr. Owen Harris    male   22      1   \n",
       "1  Cumings, Mrs. John Bradley (Florence Briggs Th...  female   38      1   \n",
       "2                             Heikkinen, Miss. Laina  female   26      0   \n",
       "3       Futrelle, Mrs. Jacques Heath (Lily May Peel)  female   35      1   \n",
       "4                           Allen, Mr. William Henry    male   35      0   \n",
       "5                                   Moran, Mr. James    male  NaN      0   \n",
       "6                            McCarthy, Mr. Timothy J    male   54      0   \n",
       "7                     Palsson, Master. Gosta Leonard    male    2      3   \n",
       "8  Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)  female   27      0   \n",
       "9                Nasser, Mrs. Nicholas (Adele Achem)  female   14      1   \n",
       "\n",
       "   Parch            Ticket     Fare Cabin Embarked  \n",
       "0      0         A/5 21171   7.2500   NaN        S  \n",
       "1      0          PC 17599  71.2833   C85        C  \n",
       "2      0  STON/O2. 3101282   7.9250   NaN        S  \n",
       "3      0            113803  53.1000  C123        S  \n",
       "4      0            373450   8.0500   NaN        S  \n",
       "5      0            330877   8.4583   NaN        Q  \n",
       "6      0             17463  51.8625   E46        S  \n",
       "7      1            349909  21.0750   NaN        S  \n",
       "8      2            347742  11.1333   NaN        S  \n",
       "9      0            237736  30.0708   NaN        C  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# taking a look at the first few rows #\n",
    "train_df.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>891.000000</td>\n",
       "      <td>891.000000</td>\n",
       "      <td>891.000000</td>\n",
       "      <td>714.000000</td>\n",
       "      <td>891.000000</td>\n",
       "      <td>891.000000</td>\n",
       "      <td>891.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>446.000000</td>\n",
       "      <td>0.383838</td>\n",
       "      <td>2.308642</td>\n",
       "      <td>29.699118</td>\n",
       "      <td>0.523008</td>\n",
       "      <td>0.381594</td>\n",
       "      <td>32.204208</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>257.353842</td>\n",
       "      <td>0.486592</td>\n",
       "      <td>0.836071</td>\n",
       "      <td>14.526497</td>\n",
       "      <td>1.102743</td>\n",
       "      <td>0.806057</td>\n",
       "      <td>49.693429</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.420000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>223.500000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>20.125000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>7.910400</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>446.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>14.454200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>668.500000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>38.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>31.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>891.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>80.000000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>512.329200</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       PassengerId    Survived      Pclass         Age       SibSp  \\\n",
       "count   891.000000  891.000000  891.000000  714.000000  891.000000   \n",
       "mean    446.000000    0.383838    2.308642   29.699118    0.523008   \n",
       "std     257.353842    0.486592    0.836071   14.526497    1.102743   \n",
       "min       1.000000    0.000000    1.000000    0.420000    0.000000   \n",
       "25%     223.500000    0.000000    2.000000   20.125000    0.000000   \n",
       "50%     446.000000    0.000000    3.000000   28.000000    0.000000   \n",
       "75%     668.500000    1.000000    3.000000   38.000000    1.000000   \n",
       "max     891.000000    1.000000    3.000000   80.000000    8.000000   \n",
       "\n",
       "            Parch        Fare  \n",
       "count  891.000000  891.000000  \n",
       "mean     0.381594   32.204208  \n",
       "std      0.806057   49.693429  \n",
       "min      0.000000    0.000000  \n",
       "25%      0.000000    7.910400  \n",
       "50%      0.000000   14.454200  \n",
       "75%      0.000000   31.000000  \n",
       "max      6.000000  512.329200  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# getting the summary statistics of the numerical columns #\n",
    "train_df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PassengerId      int64\n",
       "Survived         int64\n",
       "Pclass           int64\n",
       "Name            object\n",
       "Sex             object\n",
       "Age            float64\n",
       "SibSp            int64\n",
       "Parch            int64\n",
       "Ticket          object\n",
       "Fare           float64\n",
       "Cabin           object\n",
       "Embarked        object\n",
       "dtype: object"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# getting the datatypes of the individual columns #\n",
    "train_df.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 891 entries, 0 to 890\n",
      "Data columns (total 12 columns):\n",
      "PassengerId    891 non-null int64\n",
      "Survived       891 non-null int64\n",
      "Pclass         891 non-null int64\n",
      "Name           891 non-null object\n",
      "Sex            891 non-null object\n",
      "Age            714 non-null float64\n",
      "SibSp          891 non-null int64\n",
      "Parch          891 non-null int64\n",
      "Ticket         891 non-null object\n",
      "Fare           891 non-null float64\n",
      "Cabin          204 non-null object\n",
      "Embarked       889 non-null object\n",
      "dtypes: float64(2), int64(5), object(5)\n",
      "memory usage: 90.5+ KB\n"
     ]
    }
   ],
   "source": [
    "# more information about the dataset #\n",
    "train_df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 418 entries, 0 to 417\n",
      "Data columns (total 11 columns):\n",
      "PassengerId    418 non-null int64\n",
      "Pclass         418 non-null int64\n",
      "Name           418 non-null object\n",
      "Sex            418 non-null object\n",
      "Age            332 non-null float64\n",
      "SibSp          418 non-null int64\n",
      "Parch          418 non-null int64\n",
      "Ticket         418 non-null object\n",
      "Fare           417 non-null float64\n",
      "Cabin          91 non-null object\n",
      "Embarked       418 non-null object\n",
      "dtypes: float64(2), int64(4), object(5)\n",
      "memory usage: 39.2+ KB\n"
     ]
    }
   ],
   "source": [
    "test_df.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "So, there are 891 rows in train set and 418 rows in test set. Also as we can see, most of the columns are not null. There are few columns which have null values as well. They are:\n",
    " 1. Age\n",
    " 2. Cabin\n",
    " 3. Embarked\n",
    " 4. Cabin\n",
    " \n",
    "Out of this, 'Cabin' variable is Null for most part of the rows. So it is better to remove the 'Cabin' variable for model building."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# dropping the cabin variable #\n",
    "train_df.drop(['Cabin'], axis=1, inplace=True)\n",
    "test_df.drop(['Cabin'], axis=1, inplace=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Univariate Plots \n",
    "\n",
    "Now we will try to plot the given variables to see how they are distributed. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x7f8b531b3790>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXMAAAEFCAYAAAARwQdOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFJhJREFUeJzt3X+UXGV9x/H3khCpEEhpNL9J0gpKaAW0xh/UOlrEQGkS\nbcsPfzRNqaViVbRWiFXPrq0IbUWtlh5bNUSEYNQjjcVigDKitQ1SQ1CWmERJYEOyQUCNoWpCtn98\nn2Huzs7szuzu7CZP3q9z7pl7n/vr2cmdz33uc+9MQJIkSZIkSZIkSZIkSZIkSYegfwbeM0rbOgHY\nA3Sk6TJw0ShtG+ArwBtGcXvN+lvgEeDhcdh3rT3AvFHYzgHgV1tYfjWwZBT2e7Bq17F1LfA3afy5\nwH+1YR86DGwDngB+AjxOHEgXUw3bVrf1ihbXuQP4k2HsC6ATuG6Y646mE4j38FcGWebdwA+IoH0I\nuHEM6jVSrYT5c4H7CtPTgbXAjrSdE0a3ak9ZAtwD/Jg4md7O6JzIxtJK4P2F6ZuBc8epLuPiiP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teGbUqSBtHRhm2+COgk+swBVgAHgKsKy9wDnNqGfUtSzjYC\np43VziYC3wfmAZOI4PYGqCQdgs4GvkfcCF0xznWRJEmSDn7t6DNXe51MPOpZeUKoB1gL3D9uNZI0\n7vw6/6HlMmB1Gl+fhiNSmd1ZOlgtH+8KSAebLcCRdconEfcnpIPRQ0MvopGaON4VUEueJLpXttWU\nz0zzpPHynUHmPXPManEYM8wPLZcCtxGt8EprZw5wIvAX41UpiQjsRcDjdeZ9c4zrclgyzA8ttwDP\nJn7/ZhbxbdsdwN3A/nGsl3QzcAywoc68r41xXSRJkiRJkiRJkiRJkiSNq/8H4efle0H8wjQAAAAA\nSUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f8b53236650>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# let us get some plots to see the data #\n",
    "train_df.Survived.value_counts().plot(kind='bar', alpha=0.6)\n",
    "plt.title(\"Distribution of Survival, (1 = Survived)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x7f8b53053390>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEKCAYAAADticXcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8E/e97//XzEiyLMn7bsAYAo7DEnayEXD2lKSU7HvT\ntGlzb5e099xunN6ew72np2ny62nT3ja3SZum2Zq9CYEmTQLBEAiBFGIImMUsNovxvsmy1pn5/TEy\nOAQS44WR7c/z8dDDkixpPiPwW1995jszIIQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEGEBLgD8O\n4Ov5geL49b8A/zGAr/3/gP81gK8nhBADphxoAVyDvIwg0AG0A/8EftTHZZYDXzvN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sqVj+2Amu63g/i99v9XnVbwPHZL3bWNA7rParACofu/892v0/T\nsEbqW7FGn2kJUBNYH3xNHP8gJAHq+iHHpzQ+ifWt2e6ahBBCCCGEEEIIIYQQQgghhBBCCCGEEEII\nIYQQQgghhBDD2f8PNVVXcSxi6qkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f8b5324f050>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# scatter plot between survived and age #\n",
    "plt.scatter(range(train_df.shape[0]), np.sort(train_df.Age), alpha=0.2)\n",
    "plt.title(\"Age Distribution\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x7f8b52f205d0>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAEKCAYAAAAyx7/DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADctJREFUeJzt3XuMXGUZx/HvQMulWwSxCruALWgwarR4CVFAWNToahA1\niFHURLx0/zDxgspFja1XQBPQCCaYSEUkNSqCILJclBGvxdV2BbQqpoxIcYUClYtKbcc/3nfZs8t2\nZ2Z7trPPnu8nmeyZc2beeffp5HfOPHO2ByRJkiRJkiRJkiRJkiRJklQxq4BLuz2JSX4EvKOksV4G\nbCjcvxN4RUljA9wGHFvieJIEwCnAMPAQsIkUjEfnbSvZtcG9HXg4z+U+4EbgzTsx1mEdPmcj8PIZ\nvt43gM/M8LnSDu3W7QlozjkNOB/4LPA04BDgQuB1eXutC3N6PrAPcDgpDC8APjnDsaab/4IZjilJ\nXbMv6cj2pGkes4qJR9zfBe4BHgR+CjynsO21wO3Av4C/Ax/O65cAPwQeADYDN7PjQJ3qKPkk4N/A\nk/P9OvDuvPzMPI8HgXuB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+rtQzVoUHcf4WSVVrMWhpPfEetIps2MZWcVaSJIkSZIkSZIk\nSZIkSZIkSZIkSbvW/wF8tHojEGYFkgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f8b52fba210>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "train_df.Pclass.value_counts().plot(kind=\"barh\", alpha=0.6)\n",
    "plt.title(\"Class Distribution\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### TO DO:\n",
    "1. Create a bar graph for the variable 'Embarked'.\n",
    "2. Create a scatter plot for varibale 'fare' and check how it is distributed."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plots with DV\n",
    "Now we will make plots with DV to understand the relationship of the variables with DV"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAF4dJREFUeJzt3X2QFOWBx/HvIIIou7Cr3MqrG04tgzEGc1LmjBGNMXpn\n1JiIyvkWvUTjWRq95IRURfFSMerdlcnVldZdNArxQM3l4hulQNTVGO/EREUjIQIBFSOgsMASOHmb\n++PpYXuXfRlgemZ2nu+namp6unt6npmd7V8/L9MNkiRJkiRJkiRJkiRJkiRJkqTd1AzsAPpVuBx7\nagcwttKFUGX01S+t+o7lwCZgA9AK/Aq4Asgly58Ebu7ieWcB71E939EW4PIyvt5hwAPAamA98Cbw\nr8DIMpZBkaiWfzLVrjxwBlAPjAFuBW4A7kmW3wdc2MXzLgLuJxypVoN8GV/rUOBFYAXwCWAIcDyw\nFPh0GctRjP6VLoCk6rcMOLnTvGOB7cA4YBCwDjghtbwB2Awc1c02G4F7gXeBtcDPU8u+CiwG1gCP\nAMOT+c3s2nT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lRNSvU9VxkZBJWxitCmegqw\nGtgGLEyWzUxu3fFHd+or9uZ7rjIyCMpnLKFj7f3kcaHavIqO/xB/A3yzi+cXjpTeBSam5o8mVKGl\narC33/MlwLmpxx74qE/r3Ik2F7gpNW8I4Z/jD4QRFsVqSJ4ztNO0VAlZfc8LJmJnsfqwbXQ9rC7t\n58ALe7DtrxBqCIsJQ0mlSsnye/5LQpPSJsJQ1M/teTElSZIkSZIkSZIkSZIkSZIkSZIkSRL/D52r\nrN3NiFynAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f8b52e79850>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "train_male = train_df.Survived[train_df.Sex == 'male'].value_counts().sort_index()\n",
    "train_female = train_df.Survived[train_df.Sex == 'female'].value_counts().sort_index()\n",
    "\n",
    "ind = np.arange(2)\n",
    "width = 0.3\n",
    "fig, ax = plt.subplots()\n",
    "male = ax.bar(ind, np.array(train_male), width, color='r')\n",
    "female = ax.bar(ind+width, np.array(train_female), width, color='b')\n",
    "ax.set_ylabel('Count')\n",
    "ax.set_title('DV count by Gender')\n",
    "ax.set_xticks(ind + width)\n",
    "ax.set_xticklabels(('DV=0', 'DV=1'))\n",
    "ax.legend((male[0], female[0]), ('Male', 'Female'))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "#### TO DO:\n",
    "1. Plot a bar graph between DV and Pclass to see how the DV is distributed between the classes\n",
    "2. Draw and \"Box and Whisker plot\" between DV and age and see the distribution between age and DV"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Supervised Machine Learning\n",
    "### Logistic Regression"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Our competition wants us to predict a binary outcome. That is, it wants to know whether some will die, (represented as a 0), or survive, (represented as 1).\n",
    "\n",
    "Logistic Regression is a method to solve these kind of problems. Please read about logistic regression to have a deeper understanding."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# getting the necessary columns for building the model #\n",
    "train_X = train_df[[\"Pclass\", \"SibSp\", \"Parch\", \"Fare\"]]\n",
    "train_y = train_df[\"Survived\"]\n",
    "test_X = test_df[[\"Pclass\", \"SibSp\", \"Parch\", \"Fare\"]]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Cross Validation\n",
    "\n",
    "If we build models on the whole train dataset, how do we know the performance on the model on a new dataset?? \n",
    "\n",
    "So what we can instead do is to build the model on a part fo the dataset and then test it on the other part so that we get an idea of how our model performs on a new data. This process is known as Model Validation in Machine Learning field.\n",
    "\n",
    "So now let us split the train data into two parts\n",
    "1. Developement sample\n",
    "2. Validation Sample"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 0 0 0 0 1 0 0 0 1]\n"
     ]
    }
   ],
   "source": [
    "# split the train data into two samples #\n",
    "dev_X, val_X, dev_y, val_y = train_test_split(train_X, train_y, test_size=0.33, random_state=42)\n",
    "\n",
    "# Build the machine learning model - in this case, logistic regression #\n",
    "# Initialize the model #\n",
    "clf = lm.LogisticRegression()\n",
    "\n",
    "# Build the model on development sample #\n",
    "clf.fit(dev_X, dev_y)\n",
    "\n",
    "# Predict on the validation sample #\n",
    "val_preds = clf.predict(val_X)\n",
    "print val_preds[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "So we got the validation sample classes as prediction outputs. Now it is time to check the performance of our model. We have our validation sample predictions and we have the validation sample true labels with us. \n",
    "\n",
    "Let us compute the accuracy then.!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.70847457627118648"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# import the function that computes the accuracy score #\n",
    "from sklearn.metrics import accuracy_score\n",
    "\n",
    "accuracy_score(val_y, val_preds)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can also compute other evaluation metrics like precision, recall etc.\n",
    "\n",
    "We got the actual classes as outputs from our model. Instead if we need class probabilities, we can do the following"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.72392064,  0.27607936],\n",
       "       [ 0.61739343,  0.38260657],\n",
       "       [ 0.74565568,  0.25434432],\n",
       "       [ 0.52349124,  0.47650876],\n",
       "       [ 0.7750273 ,  0.2249727 ],\n",
       "       [ 0.37396789,  0.62603211],\n",
       "       [ 0.74585577,  0.25414423],\n",
       "       [ 0.79859062,  0.20140938],\n",
       "       [ 0.74585577,  0.25414423],\n",
       "       [ 0.33274691,  0.66725309]])"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val_preds = clf.predict_proba(val_X)\n",
    "val_preds[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "TO DO:\n",
    "1. Add \"Age\" to the existing variables list and then re-run the logistic regression algorithm. \n",
    "2. In case of exceptions, how did you overcome the same?"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
